
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel=stylesheet href='include/hoj.css' type='text/css'>
</head>
<body>
<center>
<div style="width:90%; text-align:left">
<img src="image/logo.png"/>
</div>
<table width=96%> 
	<tr align="center" class='hd' valign="top">
				<th><a href="faqs.php">F.A.Qs</a></th>
		<th><a href="./bbs.php">Web Board</a></th>
		<th><a href="./">Home</a></th>
		<th><a href="./problemset.html">ProblemSet</a></th>
		<th><a href="./status.php">Status</a></th>
		<th><a href="./ranklist.php">Ranklist</a></th>
		<th><a href="./contest.php">Contest</a></th>
		<th><a href=loginpage.php>Login</a></th><th><a href=registerpage.php>Register</a></th>	</tr>
</table>
</center>
<center>
<div class="notice">
	<div>
		<B>Notice:</B>鉴于种种原因，本OJ自下周星期一（3月5号）开始不再全面开放，请各位做好善后事宜，谢谢合作。	</div>
</div>
</center>
</div>
<title>Problem 1673. -- [Usaco2005 Dec]Scales -- 衡阳八中OJ离线版-2012-02-29</title><center><h2>1673: [Usaco2005 Dec]Scales</h2><span class=green>Time Limit: </span>5 Sec&nbsp;&nbsp;<span class=green>Memory Limit: </span>64 MB<br><span class=green>Submit: </span>139&nbsp;&nbsp;<span class=green>Solved: </span>54<br>[<a href='submitpage.php?id=1673'>Submit</a>][<a href='problemstatus.php?id=1673'>Status</a>][<a href='bbs.php?id=1673'>Discuss</a>]</center><h2>Description</h2><div class=content>Farmer John has a balance for weighing the cows. He also has a set of N (1
<= N <= 1000) weights with known masses (all of which fit in 31 bits) for
use on one side of the balance. He places a cow on one side of the balance
and then adds weights to the
other side until they balance. (FJ cannot put weights on the same side of
the balance as the cow, because cows tend to kick weights in his face
whenever they can.) The balance has a maximum mass rating and will break if
FJ uses more than a certain total mass C (1 <= C < 2^30) on one side.

The weights have the curious property that when lined up from smallest to
biggest, each weight (from the third one on) has at least as much mass as
the previous two combined.

FJ wants to determine the maximum mass that he can use his weights to
measure exactly. Since the total mass must be no larger than C, he might
not be able to put all the weights onto the scale.

Write a program that, given a list of weights and the maximum mass the
balance can take, will determine the maximum legal mass that he can weigh
exactly.
</div><h2>Input</h2><div class=content>* Line 1: Two space-separated positive integers, N and C.

* Lines 2..N+1: Each line contains a single positive integer that is
        the mass of one weight. The masses are guaranteed to be in
        non-decreasing order.

</div><h2>Output</h2><div class=content>* Line 1: A single integer that is the largest mass that can be
        accurately and safely measured.

</div><h2>Sample Input</h2>
			<div class=content><span class=sampledata>3 15//  三个物品,你的"包包"体积为15，下面再给出三个数字，从第三个数字开始，它都大于前面的二个数字之和，这个条件太重要<br />
1<br />
10<br />
20<br />
<br />
INPUT DETAILS:<br />
<br />
FJ has 3 weights, with masses of 1, 10, and 20 units. He can put at most 15<br />
units on one side of his balance.<br />
<br />
</span></div><h2>Sample Output</h2>
			<div class=content><span class=sampledata>11   //最多可以拿走多少体积的东西<br />
<br />
OUTPUT DETAILS:<br />
<br />
The 1 and 10 weights are used to measure 11. Any greater weight that can be<br />
formed from the weights will break the balance.</span></div><h2>HINT</h2>
			<div class=content><p>这个题数据远远达不到所描述的样子.....</p></div><h2>Source</h2>
			<div class=content><p><a href='problemset.html?search=Silver'>Silver</a></p></div><center>[<a href='submitpage.php?id=1673'>Submit</a>][<a href='problemstatus.php?id=1673'>Status</a>][<a href='bbs.php?id=1673'>Discuss</a>]</center>﻿<br>

<a href="./"><span class=red>HOME</span></a>
<a href="javascript:history.go(-1)"><span class=red>Back</span></a>

<hr>
<center>
	<div class="footer">
			<a href=setlang.php?lang=ko>한국어</a>&nbsp;
		<a href=setlang.php?lang=cn>中文</a>&nbsp;
		<a href=setlang.php?lang=fa>فارسی</a>&nbsp;
		<a href=setlang.php?lang=en>English</a>&nbsp;
		<a href=setlang.php?lang=th>ไทย</a>
	<br>		<div>版权所有 &copy;2008-2012 WaterPark Organization. | <script src="http://s21.cnzz.com/stat.php?id=2982771&web_id=2982771" language="JavaScript"></script>
</div>
		<div>Based on opensource project <a href="http://hustoj.googlecode.com">hustoj</a>.</div>
	</div>
</center>
</body>
</html>
